package com.cwvs.cat.adapter;

import java.util.List;

import com.cwvs.cat.R;
import com.cwvs.cat.bean.Area;
import com.cwvs.cat.bean.School;


import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CityAdapter extends BaseAdapter {
	
	private LayoutInflater mInflater = null;
	private Context mContext;
	private ViewHolder holder = null;
	private List<Area> mList;
	Activity contexts=null;
	
	public CityAdapter(Context context, List<Area> list){
		this.mInflater = LayoutInflater.from(context);
		mList = list;
		mContext = context;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.item_schoolchoose, null);
			holder = new ViewHolder();
			holder.name = (TextView) convertView.findViewById(R.id.name);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.name.setText(mList.get(position).name);
		return convertView;
	}
	
	static class ViewHolder{
        public TextView name;
    }

}

